package com.ymk.cmd;

import com.ymk.base.cmd.ACmd;
import com.ymk.base.cmd.CmdSign;
import com.ymk.base.exception.MallException;
import com.ymk.bo.user.MchDeskBO;
import com.ymk.core.code.cmd.UserCmdCode;
import com.ymk.service.IMchDeskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.Objects;

@Service
public class MchDeskPatchCmd extends ACmd {

    @Override
    public CmdSign executeMop(HttpServletRequest request, CmdSign sign) throws Exception {
        CmdSign respSign = new CmdSign(sign);
        MchDeskBO reqData = super.getData(sign, MchDeskBO.class);

        this.mchDeskService.update(reqData);

        return respSign;
    }
    @Override
    public CmdSign verify(HttpServletRequest request, CmdSign sign)throws  Exception{

        if (Objects.isNull(sign.getMchId())){
            throw  new MallException("请先登录");
        }


        return null;
    };
    @Override
    public String getCmdCode() {
        return UserCmdCode.MCH_DESK_PATCH;
    }

    @Autowired
    private IMchDeskService mchDeskService;
}